package cn.com.jonpad.demo07_data_mybatis01.mapper;

import cn.com.jonpad.demo07_data_mybatis01.entity.Emploee;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface EmploeeMapper {

	@Select("SELECT * FROM `emploee`")
	List<Emploee> getAll();

	@Select("SELECT * FROM `emploee` where id = #{id}")
	Emploee findOne(Long id);

	@Delete("delete FROM `emploee` where id = #{id}")
	int deleteOne(Long id);

	@Options(useGeneratedKeys = true,keyProperty = "id")
	@Insert("INSERT INTO `emploee` ( `username`) VALUES (#{username})")
	int save(Emploee entity);

	@Update("UPDATE `emploee` SET `username`=#{username} WHERE (`id`=#{id})")
	int update(Emploee entity);
}
